package com.baizhi.service.impl;

import com.baizhi.dao.CmfzBannerDao;
import com.baizhi.entity.CmfzBanner;
import com.baizhi.service.CmfzBannerService;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class CmfzBannerServiceImpl implements CmfzBannerService {
    @Autowired
    private CmfzBannerDao cmfzBannerDao;
    @Override
    public void insertCmfzBanner(CmfzBanner cmfzBanner) {
        cmfzBannerDao.insert(cmfzBanner);
    }

    @Override
    public void deleteCmfzBanner(Integer bannerId) {
        cmfzBannerDao.deleteById(bannerId);
    }

    @Override
    @Transactional(readOnly = true)
    public CmfzBanner selectById(Integer bannerId) {
        return cmfzBannerDao.selectById(bannerId);
    }

    @Override
    public void updateCmfzBanner(CmfzBanner cmfzBanner) {
        cmfzBannerDao.updateById(cmfzBanner);
    }

    @Override
    @Transactional(readOnly = true)
    public Page<CmfzBanner> selectPage(Integer page, Integer limit) {
        Page<CmfzBanner> bannerPage = new Page<>(page, limit);
        return cmfzBannerDao.selectPage(bannerPage,null);
    }
}
